package tn.redmine.test_suites.reports.auto;

import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import tn.redmine.data_models.User;
import tn.redmine.pages.IndexPage;
import tn.redmine.tests.RedmineTests;
import core.base.TestBase;

/**
 * Test suite - Login and Logout tests
 */
public class GolovkoReport extends TestBase
{
	// Tests
	private final RedmineTests redmineTests = new RedmineTests(pilot);

	@DataProvider
	public Object[][] testData()
	{
		User user = new User(pilot);

		return new Object[][]
		{
				{
						user.setFirstName("Alexander")
								.setLastName("Golovko")
								.setEmail("alexander.golovko@together.com")
								.setPosition("QA Automation Engineer")
								.setCategory("Senior")
								.setLevel("8")
								.setCity("ZP")
								.setCompany("TN")
								.setRedmineID("100")
								.setRedmineProject("dating-2")
		}
		};
	}

	@BeforeSuite
	public void config()
	{
		pilot.configurator()
				.setPlatform("web")
				.setOS("win7")
				.setBrowser("chrome")
				.setProxy("def");
	}

	@BeforeTest()
	public void login()
	{
		pilot.driver().openURL("https://redmine.platformphoenix.com/");

		if (!IndexPage.isLoggedIn())
		{
			IndexPage.login();
		}
	}

	@Test(dataProvider = "testData", enabled = true)
	public void reportAutoTest(User p_user)
	{
		redmineTests.reportAutoAction(p_user);
	}

}
